<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>退换货管理</h2>

    </div>
    <div class="cf">
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="date" class="text time" value="{:I('date')}" placeholder="选择统计日期"   style="width:150px;" />
            </div>
            <div class="sleft">
                <select  name="action" class="search-input" style="width:150px;">
                    <volist name="actions" id="ac">
                        <option value="{$ac.action}" {$action==$ac['action']?'selected':''}>{$ac.content}</option>
                    </volist>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="pname" class="search-input" value="{:I('pname')}" placeholder="商品名称">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('data')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>


    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table>
        <thead>
        <tr>
            <th>客户</th>
            <th>操作</th>
            <th>商品名</th>
            <th>规格</th>
            <th>数量</th>
            <th>操作人</th>
            <th>创建时间</th>
        </tr>
        </thead>
            <tbody>
                <notempty name="info">
                    <volist name="info" id="vl">
                        <tr>
                            <td>
                                {$vl.buyer}
                            </td>
                            <td>
                                <if condition="$vl['action'] eq 'rk'">
                                    入库
                                </if>
                                <if condition="$vl['action'] eq 'zzz'">
                                    转榨汁
                                </if>
                                <if condition="$vl['action'] eq 'bs'">
                                    报损
                                </if>
                            </td>
                            <td>
                                {$vl.pname}
                            </td>
                            <td>
                                {$vl.spec}
                            </td>
                            <td>
                                {$vl.num}
                            </td>
                            <td>
                                {$vl.user|get_username}
                            </td>
                            <td>
                                {$vl.createdAt|time_format}
                            </td>
                        </tr>
                    </volist>
                <else/>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        $('.time').datetimepicker({
            format: 'Y-m-d',
            lang: "ch",
            minView: 2,
            autoclose: true
        });
//        $('.time').datetimepicker();
        //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        var queryselect = $('.search-form').find('select').serialize();

        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        queryselect = queryselect.replace(/^&/g, '');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
            url += '&' + queryselect;
        }else{
            url += '?' + query;
            url += '&' + queryselect;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        //导航高亮
        highlight_subnav('{:U('Reject/data')}');
    </script>
</block>
